<?php

namespace App\Sdks\Feishu\Traits;

trait Contact
{
    /**
     * @return mixed
     * 获取通讯录
     */
    public function getContacts(){
        $url = $this->getApiUrl('get_scope_contact');

        $ret = $this->authRequest($url);

        return $ret;
    }

    /**
     * @param $departmentId
     * @return mixed
     * 获取部门通讯录
     */
    public function getDepartmentContacts($departmentId){
        $url = $this->getApiUrl('get_department_user_list');

        $query = [
            'department_id' => $departmentId,
            'page_size' => 100,
            'fetch_child' => true,
        ];

        $url .= '?'. http_build_query($query);

        $ret = $this->authRequest($url);

        return $ret;
    }

}
